; Music of Madmix 2 (1988) (Topo Soft)
; Ripped by Megachur the 20/04/2007

	write "MADMIX2.BIN"

music_date_rip	equ &1447
music_adr	equ &1f23
first_theme	equ 0
last_theme	equ 0

	read "music_header_v1_0.asm"
;
.init_music
;
	call l1f3e
	xor a
	ld de,l283f
	call l1f53
	ld a,#01
	ld de,l286e
	call l1f53
	ld a,#02
	ld de,l289d
	call l1f53
	ret
;
.stop_music
.l1f3e
;
	di
	xor a
	ld de,#0000
	call l1f53
	inc a
	call l1f53
	inc a
	call l1f53
	call l1f72
	ei
	ret
.l1f53
	push af
	push de
	ld de,#002e
	call l2314
	ld de,l246e
	add hl,de
	push hl
	xor a
	ld b,#2e
.l1f63
	ld (hl),a
	inc hl
	djnz l1f63
	pop hl
	pop de
	ld (hl),e
	inc hl
	ld (hl),d
	inc hl
	ld (hl),e
	inc hl
	ld (hl),d
	pop af
	ret
;
.play_music
.l1f72
;
	push af
	ld b,#03
	xor a
	ld ix,l246e
	ld de,l2463
	ld hl,l246b
.l1f80
	push af
	push hl
	push de
	push bc
	ld (l2461),a
	ld a,(ix+#04)
	or (ix+#05)
	jp nz,l1feb
	xor a
	call l22b5
	ld c,(ix+#02)
	ld b,(ix+#03)
	ld a,b
	or c
	jp z,l20a4
.l1f9f
	ld a,(bc)
	cp #80
	jp c,l1fae
	sub #80
	ld hl,l2443
	call l2343
	jp (hl)
.l1fae
	push af
	call l2309
	pop af
	add (hl)
	ld hl,l2383
	call l2343
	ld (ix+#0a),l
	ld (ix+#0b),h
	inc bc
.l1fc1
	ld a,(ix+#08)
	call l22b5
	call l2120
	ld (ix+#2a),#00
	call l2138
	ld (ix+#2b),#00
	ld (ix+#2c),#00
.l1fd9
	ld (ix+#02),c
	ld (ix+#03),b
	ld l,(ix+#06)
	ld h,(ix+#07)
	ld (ix+#04),l
	ld (ix+#05),h
.l1feb
	ld l,(ix+#04)
	ld h,(ix+#05)
	dec hl
	ld (ix+#04),l
	ld (ix+#05),h
	push ix
	pop iy
	ld d,#02
	ld c,#00
.l2000
	ld a,(iy+#0c)
	or a
	jr z,l200d
	dec a
	ld (iy+#0c),a
	inc c
	jr l202e
.l200d
	ld a,(iy+#0e)
	or a
	jr z,l2029
	dec a
	ld (iy+#0e),a
	ld a,(ix+#2a)
	add (iy+#1b)
	ld (ix+#2a),a
	ld a,(iy+#20)
	ld (iy+#0c),a
	inc c
	jr l202e
.l2029
	inc iy
	dec d
	jr nz,l2000
.l202e
	ld a,c
	or a
	jr nz,l2039
	bit 0,(ix+#2d)
	call nz,l2120
.l2039
	push ix
	pop iy
	ld d,#03
	ld c,#00
.l2041
	ld a,(iy+#10)
	or a
	jr z,l204e
	dec a
	ld (iy+#10),a
	inc c
	jr l2099
.l204e
	ld a,(iy+#13)
	or a
	jr z,l2094
	dec a
	ld (iy+#13),a
	ld a,(iy+#1d)
	or a
	jp p,l2078
	ld a,(iy+#1d)
	cpl
	inc a
	ld e,a
	ld a,(ix+#2b)
	sub e
	ld (ix+#2b),a
	ld a,(ix+#2c)
	sbc #00
	and #0f
	ld (ix+#2c),a
	jr l208b
.l2078
	ld a,(ix+#2b)
	add (iy+#1d)
	ld (ix+#2b),a
	ld a,(ix+#2c)
	adc #00
	and #0f
	ld (ix+#2c),a
.l208b
	ld a,(iy+#22)
	ld (iy+#10),a
	inc c
	jr l2099
.l2094
	inc iy
	dec d
	jr nz,l2041
.l2099
	ld a,c
	or a
	jr nz,l20a4
	bit 1,(ix+#2d)
	call nz,l2138
.l20a4
	pop bc
	pop de
	pop hl
	ld a,(ix+#09)
	add (ix+#2a)
	and #0f
	ld (hl),a
	ld a,(ix+#0a)
	add (ix+#2b)
	ld (de),a
	inc de
	ld a,(ix+#0b)
	adc (ix+#2c)
	ld (de),a
	inc de
	push de
	ld de,#002e
	add ix,de
	pop de
	pop af
	inc a
	inc hl
	dec b
	jp nz,l1f80
	ld iy,l24f8
	ld d,#02
	ld c,#00
.l20d6
	ld a,(iy+#00)
	or a
	jr z,l20e3
	dec a
	ld (iy+#00),a
	inc c
	jr l2104
.l20e3
	ld a,(iy+#02)
	or a
	jr z,l20ff
	dec a
	ld (iy+#02),a
	ld a,(l2504)
	add (iy+#06)
	ld (l2504),a
	ld a,(iy+#08)
	ld (iy+#00),a
	inc c
	jr l2104
.l20ff
	inc iy
	dec d
	jr nz,l20d6
.l2104
	ld a,c
	or a
	jr nz,l2110
	ld a,(l2502)
	bit 2,a
	call nz,l2150
.l2110
	ld a,(l2503)
	ld e,a
	ld a,(l2504)
	add e
	ld (l2469),a
	call l2350
	pop af
	ret
.l2120
	push ix
	ld d,#02
.l2124
	ld a,(ix+#20)
	ld (ix+#0c),a
	ld a,(ix+#16)
	ld (ix+#0e),a
	inc ix
	dec d
	jr nz,l2124
	pop ix
	ret
.l2138
	ld d,#03
	push ix
.l213c
	ld a,(ix+#22)
	ld (ix+#10),a
	ld a,(ix+#18)
	ld (ix+#13),a
	inc ix
	dec d
	jr nz,l213c
	pop ix
	ret
.l2150
	ld d,#02
	push iy
	ld iy,l24f8
.l2158
	ld a,(iy+#08)
	ld (iy+#00),a
	ld a,(iy+#04)
	ld (iy+#02),a
	inc iy
	dec d
	jr nz,l2158
	pop iy
	ret
.l216c
	inc bc
	ld a,(bc)
	ld (ix+#09),a
	inc bc
	jp l1f9f
.l2175
	inc bc
	ld a,(bc)
	ld de,(l2462)
	ld d,#00
	call l2314
	ld (ix+#06),l
	ld (ix+#07),h
	inc bc
	jp l1f9f
.l218a
	inc bc
	ld a,(bc)
	and #09
	ld (ix+#08),a
	inc bc
	jp l1f9f
.l2195
	push ix
	pop hl
	xor a
	ld b,#2e
.l219b
	ld (hl),a
	inc hl
	djnz l219b
	ld a,(l2461)
	ld hl,l2505
	xor (hl)
	jp nz,l20a4
	ld hl,l24f8
	ld de,l24f9
	ld bc,#000a
	ld (hl),a
	ldir
	inc de
	ld (de),a
	jp l20a4
.l21ba
	inc bc
	ld a,(bc)
	push bc
	ld de,#0010
	call l2314
	ld bc,#0bb8
	push hl
	pop de
	call l2329
	ld a,c
	ld (l2462),a
	pop bc
	inc bc
	jp l1f9f
.l21d4
	inc bc
	ld a,(bc)
	push af
	and #1f
	ld (l2503),a
	call l2150
	pop af
	inc bc
	or a
	jp m,l1f9f
	jp l1fc1
.l21e8
	inc bc
	jp l1fd9
.l21ec
	ld c,(ix+#00)
	ld b,(ix+#01)
	ld (ix+#02),c
	ld (ix+#03),b
	jp l1f9f
.l21fb
	inc bc
	ld a,(bc)
	inc bc
	ld de,#0000
.l2201
	push af
	ld a,(bc)
	push de
	ld de,(l2462)
	ld d,#00
	call l2314
	pop de
	add hl,de
	ex de,hl
	inc bc
	pop af
	dec a
	jr nz,l2201
	ld (ix+#06),l
	ld (ix+#07),h
	jp l1f9f
.l221e
	inc bc
	ld a,(bc)
	ld e,a
	or (ix+#2d)
	ld (ix+#2d),a
	ld a,(l2502)
	or e
	ld (l2502),a
	inc bc
	jp l1f9f
.l2232
	inc bc
	res 0,(ix+#2d)
	res 1,(ix+#2d)
	ld a,(bc)
	ld de,#000f
	call l2314
	ld de,l250f
	add hl,de
	push ix
	ld d,#0f
.l224a
	ld a,(hl)
	ld (ix+#16),a
	inc hl
	inc ix
	dec d
	jp nz,l224a
	pop ix
	inc bc
	ld (ix+#0c),#00
	ld (ix+#0d),#00
	ld (ix+#10),#00
	ld (ix+#11),#00
	ld (ix+#12),#00
	ld (ix+#2a),#00
	ld (ix+#2b),#00
	ld (ix+#2c),#00
	jp l1f9f
.l227b
	inc bc
	ld a,(l2502)
	res 2,a
	ld (l2502),a
	ld a,(bc)
	ld de,#0006
	call l2314
	ld de,l2578
	add hl,de
	ld iy,l24f8
	ld (iy+#00),#00
	ld (iy+#01),#00
	ld d,#06
.l229d
	ld a,(hl)
	ld (iy+#04),a
	inc hl
	inc iy
	dec d
	jr nz,l229d
	xor a
	ld (l2504),a
	inc bc
	ld a,(l2461)
	ld (l2505),a
	jp l1f9f
.l22b5
	push de
	cpl
	ld e,a
	ld d,#09
	ld a,(l2461)
.l22bd
	dec a
	jp m,l22c8
	scf
	rl e
	sla d
	jr l22bd
.l22c8
	ld a,(l246a)
	or d
	and e
	ld (l246a),a
	pop de
	ret
.l22d2
	ld a,(l2461)
	inc bc
	add a
	ld l,a
	ld h,#00
	ld a,(bc)
	inc bc
	ld de,l2506
	add hl,de
	ld (hl),c
	inc hl
	ld (hl),b
	ld hl,l2584
	call l2343
	ld b,h
	ld c,l
	jp l1f9f
.l22ee
	ld a,(l2461)
	add a
	ld l,a
	ld h,#00
	ld de,l2506
	add hl,de
	ld c,(hl)
	inc hl
	ld b,(hl)
	jp l1f9f
.l22ff
	inc bc
	call l2309
	ld a,(bc)
	inc bc
	ld (hl),a
	jp l1f9f
.l2309
	ld a,(l2461)
	ld l,a
	ld h,#00
	ld de,l250c
	add hl,de
	ret
.l2314
	ld hl,#0000
	and a
	ret z
	push bc
	ld b,#08
.l231c
	srl a
	jr nc,l2321
	add hl,de
.l2321
	sla e
	rl d
	djnz l231c
	pop bc
	ret
.l2329
	push af
	ld hl,#0000
	ld a,b
	ld b,#10
.l2330
	rl c
	rla
	adc hl,hl
	sbc hl,de
	jr nc,l233a
	add hl,de
.l233a
	ccf
	djnz l2330
	rl c
	rla
	ld b,a
	pop af
	ret
.l2343
	push af
	add a
	add l
	ld l,a
	jr nc,l234a
	inc h
.l234a
	ld a,(hl)
	inc hl
	ld h,(hl)
	ld l,a
	pop af
	ret
.l2350
	ld b,#f7
	ld c,#82
	out (c),c
	ld hl,l2463
	ld a,#00
	ld d,#0b
.l235d
	push af
	ld c,(hl)
	ld b,#f4
	out (c),a
	ld b,#f6
	in a,(c)
	or #c0
	out (c),a
	and #3f
	out (c),a
	ld b,#f4
	out (c),c
	ld b,#f6
	ld c,a
	or #80
	out (c),a
	out (c),c
	pop af
	inc a
	inc hl
	dec d
	jr nz,l235d
	ret
.l2383
	dw #0eee,#0e18,#0d4d,#0c8e
	dw #0bda,#0b2f,#0a8f,#09f7
	dw #0968,#08e1,#0861,#07e9
	dw #0777,#070c,#06a7,#0647
	dw #05ed,#0598,#0547,#04fc
	dw #04b4,#0470,#0431,#03f4
	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f,#002d,#002a,#0028
	dw #0026,#0024,#0022,#0020
	dw #001e,#001c,#001b,#0019
	dw #0018,#0016,#0015,#0014
	dw #0013,#0012,#0011,#0010
.l2443
	dw l216c,l218a,l21ec,l2175
	dw l21e8,l21ba,l21fb,l2232
	dw l21d4,l227b,l221e,l2195
	dw l22d2,l22ee,l22ff
.l2463 equ $ + 2
.l2462 equ $ + 1
.l2461
	db #1e,#13,#45,#2b,#1e,#13,#12,#1d
.l246e equ $ + 5
.l246b equ $ + 2
.l246a equ $ + 1
.l2469
	db #12,#13,#1c,#13,#45,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l24f8 equ $ + 7
	db #00,#00,#00,#00,#00,#00,#00,#0e
.l24f9
	db #13,#1c,#07,#00,#00,#00,#00,#fe
.l2506 equ $ + 5
.l2505 equ $ + 4
.l2504 equ $ + 3
.l2503 equ $ + 2
.l2502 equ $ + 1
	db #00,#00,#00,#00,#01,#00,#00,#00
.l250f equ $ + 6
.l250c equ $ + 3
	db #00,#0a,#00,#00,#00,#00,#07,#00
	db #00,#00,#00,#fe,#00,#00,#00,#00
	db #01,#00,#00,#00,#00,#0a,#00,#00
	db #00,#00,#ff,#00,#00,#00,#00,#03
	db #00,#00,#00,#00,#03,#0a,#00,#00
	db #00,#fe,#ff,#00,#00,#00,#01,#02
	db #00,#00,#00,#01,#01,#00,#00,#00
	db #04,#fc,#00,#00,#00,#01,#01,#00
	db #00,#00,#01,#01,#01,#01,#00,#04
	db #fc,#03,#fd,#00,#01,#01,#01,#01
	db #00,#01,#01,#14,#01,#00,#00,#f1
	db #00,#00,#00,#03,#01,#00,#00,#00
	db #02,#01,#00,#00,#00,#fe,#01,#00
.l2578 equ $ + 7
	db #00,#00,#02,#01,#00,#00,#00,#0a
	db #00,#00,#00,#01,#00,#1e,#00,#f7
	db #00,#01,#00
.l2584
	dw l25ae,l25d7,l2600,l2649
	dw l2692,l270d,l2776,l283f
	dw l283f,l283f,l283f,l283f
	dw l283f,l283f,l283f,l283f
	dw l283f,l283f,l283f,l283f
	dw l283f
.l25ae
	db #87,#01,#81,#01,#80,#0d,#83,#0c
	db #24,#26,#27,#26,#24,#26,#27,#24
	db #29,#2b,#2c,#2b,#29,#2b,#2c,#29
	db #23,#24,#26,#24,#23,#24,#26,#23
	db #24,#26,#27,#24,#26,#27,#29,#26
.l25d7 equ $ + 1
	db #8d,#87,#01,#81,#01,#80,#0d,#83
	db #0c,#33,#32,#30,#32,#33,#32,#30
	db #33,#38,#37,#35,#37,#38,#37,#35
	db #38,#32,#30,#2f,#30,#32,#30,#2f
	db #32,#33,#32,#30,#33,#35,#33,#32
.l2600 equ $ + 2
	db #35,#8d,#87,#06,#81,#01,#80,#0f
	db #83,#06,#1f,#24,#27,#2b,#30,#33
	db #37,#3c,#37,#33,#30,#2b,#27,#24
	db #1f,#1b,#1d,#24,#29,#2b,#30,#35
	db #38,#3c,#38,#35,#30,#2b,#29,#24
	db #1d,#18,#1f,#23,#26,#2b,#2f,#32
	db #37,#3b,#37,#32,#2f,#2b,#26,#23
	db #1f,#1a,#1f,#24,#27,#2b,#30,#33
	db #37,#3c,#1d,#20,#23,#26,#29,#2c
.l2649 equ $ + 3
	db #2f,#32,#8d,#87,#01,#81,#01,#80
	db #0d,#83,#06,#2b,#24,#2b,#24,#2b
	db #24,#2b,#24,#2b,#24,#2b,#24,#2b
	db #24,#2b,#24,#2b,#24,#2b,#24,#2b
	db #24,#2b,#24,#29,#23,#29,#23,#29
	db #23,#29,#23,#2c,#26,#2c,#26,#2c
	db #26,#2c,#26,#2b,#27,#2b,#27,#2b
	db #27,#2b,#27,#29,#26,#29,#26,#29
	db #26,#29,#26,#2b,#24,#2b,#24,#2b
.l2692 equ $ + 4
	db #24,#2b,#24,#8d,#87,#01,#81,#01
	db #80,#0f,#83,#0c,#30,#3c,#83,#06
	db #38,#83,#0c,#37,#83,#06,#33,#32
	db #83,#0c,#30,#83,#06,#2f,#83,#18
	db #30,#83,#03,#33,#32,#30,#32,#33
	db #32,#30,#32,#33,#32,#30,#32,#33
	db #32,#30,#32,#83,#06,#33,#83,#0c
	db #32,#83,#06,#31,#83,#0c,#32,#33
	db #83,#03,#35,#37,#38,#37,#35,#37
	db #38,#37,#35,#37,#38,#37,#35,#37
	db #38,#37,#33,#35,#37,#35,#33,#35
	db #37,#35,#33,#35,#37,#35,#33,#35
	db #37,#35,#32,#33,#35,#33,#32,#33
	db #35,#33,#32,#33,#35,#33,#32,#33
	db #35,#33,#83,#06,#32,#83,#0c,#30
.l270d equ $ + 7
	db #83,#06,#2f,#83,#18,#30,#8d,#87
	db #01,#81,#01,#80,#0d,#83,#06,#2b
	db #24,#2b,#24,#2b,#24,#2b,#24,#2b
	db #24,#2b,#24,#26,#1f,#26,#1f,#26
	db #1f,#26,#1f,#26,#1f,#26,#1f,#30
	db #29,#30,#29,#30,#29,#30,#29,#30
	db #29,#30,#29,#26,#1f,#26,#1f,#26
	db #1f,#26,#1f,#28,#1f,#29,#1f,#2b
	db #24,#28,#24,#2b,#24,#28,#24,#2b
	db #24,#28,#24,#26,#1f,#23,#1f,#26
	db #1f,#23,#1f,#26,#1f,#23,#1f,#30
	db #29,#2d,#29,#30,#29,#2d,#29,#30
	db #29,#2d,#29,#26,#1f,#23,#1f,#28
	db #1f,#24,#1f,#29,#1f,#26,#1f,#8d
.l2776
	db #87,#01,#81,#01,#80,#0e,#83,#03
	db #3c,#3b,#39,#3b,#39,#37,#39,#37
	db #35,#37,#35,#34,#35,#34,#32,#34
	db #32,#30,#32,#30,#2f,#30,#2f,#2d
	db #2b,#2d,#2f,#2d,#2f,#30,#2f,#30
	db #32,#30,#32,#34,#32,#34,#35,#34
	db #35,#37,#35,#37,#39,#37,#39,#3b
	db #48,#45,#47,#43,#45,#41,#43,#40
	db #41,#3e,#40,#3c,#3e,#3b,#3c,#39
	db #32,#37,#39,#35,#37,#34,#35,#32
	db #2b,#2d,#2f,#2d,#2f,#30,#2f,#30
	db #32,#30,#32,#34,#32,#34,#35,#34
	db #35,#37,#35,#37,#39,#37,#39,#3b
	db #3c,#34,#37,#30,#3c,#34,#37,#30
	db #3c,#34,#37,#30,#3c,#34,#37,#30
	db #3c,#3b,#39,#37,#35,#34,#32,#30
	db #37,#2f,#32,#2b,#37,#2f,#32,#2b
	db #37,#2f,#32,#2b,#37,#2f,#32,#2b
	db #37,#35,#34,#32,#30,#2f,#2d,#2b
	db #41,#39,#3c,#35,#41,#39,#3c,#35
	db #41,#39,#3c,#35,#41,#39,#3c,#35
	db #41,#40,#3e,#3c,#3b,#39,#37,#35
	db #37,#2f,#32,#2b,#37,#2f,#32,#2b
	db #37,#2f,#32,#2b,#37,#2f,#32,#2b
	db #37,#35,#34,#32,#30,#2f,#2d,#2b
.l283f equ $ + 1
	db #8d,#85,#64,#8e,#00,#8c,#00,#8c
	db #00,#8c,#00,#8c,#03,#8c,#03,#8e
	db #01,#8c,#03,#8c,#03,#8e,#00,#8c
	db #00,#8c,#00,#8c,#00,#8c,#03,#8c
	db #03,#8e,#01,#8c,#03,#8c,#03,#8e
	db #00,#8c,#05,#8c,#05,#8c,#05,#82
.l286e
	db #85,#64,#8e,#00,#8c,#01,#8c,#01
	db #8c,#01,#8c,#04,#8c,#04,#8e,#01
	db #8c,#04,#8c,#04,#8e,#00,#8c,#01
	db #8c,#01,#8c,#01,#8c,#04,#8c,#04
	db #8e,#01,#8c,#04,#8c,#04,#8e,#00
.l289d equ $ + 7
	db #8c,#06,#8c,#06,#8c,#06,#82,#85
	db #64,#8e,#00,#8c,#02,#8e,#0c,#8c
	db #02,#8e,#18,#8c,#02,#8e,#0c,#8c
	db #03,#8e,#18,#8c,#03,#8e,#0d,#8c
	db #03,#8e,#19,#8c,#03,#8e,#00,#8c
	db #02,#8e,#0c,#8c,#02,#8e,#18,#8c
	db #02,#8e,#0c,#8c,#03,#8e,#18,#8c
	db #03,#8e,#0d,#8c,#03,#8e,#19,#8c
	db #03,#8e,#0c,#8c,#06,#8e,#18,#8c
	db #06,#8e,#24,#8c,#06,#82

.game_name
	db "Madmix 2",0
.game_year
	db "1988",0
.game_publisher
	db "Topo Soft",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
